<?php
/* 
 * class.dfw.php
 * 我的城市首页-商家大富翁
 * @author samuel
 * @date 2009-05-24
 */
include_once 'class.mycityBase.php';
class mycity_dfw extends mycityBase {
    private $seller_id;
    private $step;


    function  __construct($core) {
        parent::__construct();
        //参数处理
	    $this->step = $this->params['step'] ? strtolower(trim($core->params['step'])) : 'index';
	    $this->seller_id = $this->params['sid'] ? (int)$this->params['sid'] : 0;
	    $this->user_id = $this->params['uid'] ? (int)$this->params['uid'] : 1;
	    $this->type = $this->params['type'] ? trim($this->params['type']) : 'info';
	    if(!$this->user_id){
		    $this->error = "用户ID不合法！";
		    $this->jumpError();
		    exit;
	    }
	    if(!$this->seller_id){
		    $this->error = "商家ID不合法！";
		    $this->jumpError();
		    exit;
	    }

        $run = "run_" . $this->step;
        
        //header("Content-type: text/vnd.wap.wml");
        $this->$run();
    }

    
    function run_index(){
        $page_title = "我的城市-商家实景";
	    $content = "";
	    $content .= "<a href='".$_SERVER['PHP_SELF']."?act=sellerinfo&amp;sid=".$this->seller_id."&amp;uid=".$this->user_id."' alt='返回上级'>返回上级</a><br/>";
	    //获取商家信息）
	    $sellerBase = $this->core->load('seller::sellerBase');
	    $seller = $sellerBase->getSellerInfo($this->seller_id);
	    $content .= $seller['SellerNameCN'] . "(".$seller['SellerNo'].")<br/>";
	    $gradeIcons = $this->getSellerGradeIcon($seller['SellerGrade']);
	    $content .= $gradeIcons."<br/>";
	    //获取评分人数
	    $grade_counts = $this->getSellerGrades($this->seller_id, '', true);
	    $content .= "(已有".(int)$grade_counts."人评分)<br/>";
	
	    $content .= "<a href='".$_SERVER['PHP_SELF']."?act=collect&amp;sid=".$this->seller_id."&amp;uid=".$this->user_id."'>收藏</a>|<a href='".$_SERVER['PHP_SELF']."?act=grade&amp;sid=".$this->seller_id."&amp;uid=".$this->user_id."'>评分</a>|<a href=''>大富翁</a><br/>";
	    $content .= "<a href='".$_SERVER['PHP_SELF']."?act=sellerinfo&amp;sid=".$this->seller_id."&amp;uid=".$this->user_id."'>信息</a>|<a href='".$_SERVER['PHP_SELF']."?act=sellerinfo&amp;step=discount&amp;sid=".$this->seller_id."&amp;uid=".$this->user_id."'>优惠</a>|<a href='".$_SERVER['PHP_SELF']."?act=special&amp;sid=".$this->seller_id."&amp;uid=".$this->user_id."'>特色</a><br/>";
	    $content .= "<a href=''>评价</a>|<a href=''>停车</a>|<a href=''>实景</a><br/>";
	
	    $content .= "----------<br/>";
	    $content .= "<a href='".$_SERVER['PHP_SELF']."?act=dfw&amp;sid=".$this->seller_id."&amp;uid=".$this->user_id."'>信息</a>｜<a href='".$_SERVER['PHP_SELF']."?act=dfw&amp;sid=".$this->seller_id."&amp;uid=".$this->user_id."&amp;type=ope'>操作</a><br/>";
	    
	    if($this->type == 'info'){
	        $sellerOwn = $seller['SellerOwner'];
	        $sellerOwn_info = $this->core->load('user::userBase')->getInfo(array('table'=>'fun_user', 'primary'=>'UserID'), $sellerOwn);
	        //var_dump($sellerOwn_info);
	        
	        $content .= "店主:".$sellerOwn_info['UserNickName']."<br/>";
	        $content .= "今日税收:".$seller['SellerIncome']."<br/>";
	        $content .= "今日客人:".$seller['SellerDayHitsOwn']."<br/>";
	    }elseif($this->type == 'ope'){
	        $content .= "店主显示<br/>修改商店信息店主显示<br/>修改商店信息<br/>";
	    }
	    
	    $content .= "<br/><br/>";
	    
	    $content .= "<a href='".$_SERVER['PHP_SELF']."?act=sellerinfo&amp;sid=".$this->seller_id."&amp;uid=".$this->user_id."' alt='返回上级'>返回上级</a><br/>";
	    $content .= "<a href='' alt='建议帮助'>建议帮助</a>";



	    $this->core->tpl->assign('content', $content);
	    $this->core->tpl->assign('page_title', $page_title);
	    $this->core->tpl->display('comm.wml');
    }
}


?>
